// 判断是否含有某个类名
export function hasClass (elem, className) {
  return elem.className.indexOf(className) > -1
}
// 添加class
export function addClass (elem, className) {
  if (!this.hasClass(elem, className)) {
    if (!new RegExp('(^|\\s)' + className + '(\\s|$)').test(elem.className)) elem.className += ' ' + className
  }
}
// 移除class
export function removeClass (elem, className) {
  if (this.hasClass(elem, className)) {
    elem.className = elem.className.replace(new RegExp('(^|\\s)' + className + '(?=(\\s|$))', 'g'), '')
  }
}
